package com.sky.controller;

import com.sky.exception.MyException;
import com.sky.service.DemoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
public class IndexController {

    @Resource
    public DemoService demoService;

    @RequestMapping("/target")
    public ModelAndView show() {
        System.out.println("目标资源执行...");
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("name", "bigClever");
        modelAndView.setViewName("index");
        return modelAndView;
    }

    @RequestMapping("/show")
    public String show1() throws MyException {
        demoService.show5();
        return "../show";
    }
}
